/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.subway.persistencias;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Héctor <UFG>
 */
@Entity
@Table(name = "pedido_registro", catalog = "bd_subway", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PedidoRegistro.findAll", query = "SELECT p FROM PedidoRegistro p"),
    @NamedQuery(name = "PedidoRegistro.findByRegPedId", query = "SELECT p FROM PedidoRegistro p WHERE p.regPedId = :regPedId")})
public class PedidoRegistro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "regPedId")
    private Integer regPedId;
    @JoinColumn(name = "regPedPedidoId", referencedColumnName = "pedId", nullable = false)
    @ManyToOne(optional = false)
    private Pedido regPedPedidoId;
    @JoinColumn(name = "regPedClienteId", referencedColumnName = "clienteId", nullable = false)
    @ManyToOne(optional = false)
    private Cliente regPedClienteId;
    @JoinColumn(name = "regPedProdId", referencedColumnName = "prodId", nullable = false)
    @ManyToOne(optional = false)
    private Producto regPedProdId;

    public PedidoRegistro() {
    }

    public PedidoRegistro(Integer regPedId) {
        this.regPedId = regPedId;
    }

    public Integer getRegPedId() {
        return regPedId;
    }

    public void setRegPedId(Integer regPedId) {
        this.regPedId = regPedId;
    }

    public Pedido getRegPedPedidoId() {
        return regPedPedidoId;
    }

    public void setRegPedPedidoId(Pedido regPedPedidoId) {
        this.regPedPedidoId = regPedPedidoId;
    }

    public Cliente getRegPedClienteId() {
        return regPedClienteId;
    }

    public void setRegPedClienteId(Cliente regPedClienteId) {
        this.regPedClienteId = regPedClienteId;
    }

    public Producto getRegPedProdId() {
        return regPedProdId;
    }

    public void setRegPedProdId(Producto regPedProdId) {
        this.regPedProdId = regPedProdId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (regPedId != null ? regPedId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PedidoRegistro)) {
            return false;
        }
        PedidoRegistro other = (PedidoRegistro) object;
        if ((this.regPedId == null && other.regPedId != null) || (this.regPedId != null && !this.regPedId.equals(other.regPedId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.subway.persistencias.PedidoRegistro[ regPedId=" + regPedId + " ]";
    }
    
}
